package cn.edu.gzist.chapter03.controller;

import cn.edu.gzist.chapter03.exception.MyException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ExceptionController {

    @RequestMapping("/exception")
    public String exception(String id) {

        int i = Integer.parseInt(id);
        if (i < 0) {
           throw new MyException("id 不能小于0");
        }
        return "hello";

    }
}
